package com.lin.sunnyweather.ui.weather

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.lin.sunnyweather.logic.Repository

class ForecastViewModel : ViewModel() {
    private val searchLiveData = MutableLiveData<String>()

    val forecastLiveData = Transformations.switchMap(searchLiveData) {
        Repository.threeDayWeather(it)
    }

    fun searchForecast(location: String) {
        searchLiveData.value = location
    }
}